package org.roma.ninemen;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 
 * @author Mathias Larsson and Robin Weidelid
 *
 */
public class GamesArrayAdapter extends ArrayAdapter<String> {

		private final Activity context;
		private final String[] games;

		public GamesArrayAdapter(Activity context, String[] games) {
			super(context, R.layout.saverow, games);
			this.context = context;
			this.games = games;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			LayoutInflater inflater = context.getLayoutInflater();
			View rowView = inflater.inflate(R.layout.saverow, null, true);
			TextView viewText = (TextView) rowView.findViewById(R.id.saveRowText);
			TextView viewNumber = (TextView) rowView.findViewById(R.id.saveRowNumber);
			viewText.setText(games[position]);
			viewNumber.setText(""+position);

			return rowView;
		}
	
}

